package com.emzoism.springboot.springbootdive;

import com.emzoism.springboot.springbootdive.config.DeptModel;
import com.emzoism.springboot.springbootdive.config.UserModel;
import com.emzoism.springboot.springbootdive.util.SpringContextUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringbootDiveApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootDiveApplication.class, args);
//        UserModel userModel = context.getBean("userModel", UserModel.class);
//        System.out.println("---->原生userModel"+userModel.toString());
        DeptModel deptModel = context.getBean("deptModel", DeptModel.class);
        System.out.println("---->原生deptModel"+deptModel.toString());

//        UserModel userBean = SpringContextUtil.getBean(UserModel.class);
//        System.out.println("---->自定义userBean"+userBean.toString());
        DeptModel deptBean = SpringContextUtil.getBean(DeptModel.class);
        System.out.println("---->自定会deptModel"+deptBean.toString());
    }

}
